package com.hqyj.product.service.impl;

import com.hqyj.product.mapper.ProductPlanMapper;
import com.hqyj.product.model.ProductPlan;
import com.hqyj.product.service.ProductPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class ProductPlanServiceImpl implements ProductPlanService {

    @Autowired
    private ProductPlanMapper productPlanMapper;

    @Override
    public List<ProductPlan> queryAllProductPlan(){
        return productPlanMapper.queryAllProductPlan();
    }

    @Override
    public int addProductPlanByProductPlan(ProductPlan productPlan) {
        return productPlanMapper.insertSelective(productPlan);
    }

    @Override
    public int deleteProductPlanById(int id) {
        return productPlanMapper.deleteByPrimaryKey(id);
    }

    @Override
    public ProductPlan queryProductPlanById(int productPlanId) {
        return productPlanMapper.selectByPrimaryKey(productPlanId);
    }

    @Override
    public int updateProductPlanByProductPlan(ProductPlan productPlan) {
        return productPlanMapper.updateByPrimaryKeySelective(productPlan);
    }

    @Override
    public int addProductPlanByOrderInfo(String productName, Integer orderQuantity) {
        return productPlanMapper.addProductPlanByOrderInfo(productName,orderQuantity);
    }
}
